//
//  CMDBFansManager.swift
//  CMDB
//
//  Created by 王磊 on 17/4/6.
//  Copyright © 2017年 CMDB. All rights reserved.
//

import UIKit

class CMDBFansManager: NSObject {
    
    static let getInstance: CMDBFansManager = CMDBFansManager()
    
    private override init() {
        super.init()
        
    }
}
extension CMDBFansManager: CMDBFansManagerDelegate {
    
    func fans(fansParam: CMDBFansParam, handler: CMDBCommonHandler, error: CMDBHttpErrorHandler, failure: CMDBHttpFailureHandler) {
        
        //        guard fansParam.fansType != CMDBFansType.UnKnown else {
        //
        //            printLog(CMDBCommonExceptionCodeType.FansTypeUnSelected.rawValue)
        //
        //            throw CMDBCommonExceptionType.ExceptionCode(code: CMDBCommonExceptionCodeType.FansTypeUnSelected)
        //        }
        
        CMDBHttpManager.getInstance.request(fansParam.URLString(), param: fansParam.keyValues, success: { (sysTime, data, page) in
            
            handler(isSuccess: true)
            
            }, error: error, failure: failure)
    }
    func cancleFans(fansParam: CMDBCancleFansParam, handler: CMDBCommonHandler, error: CMDBHttpErrorHandler, failure: CMDBHttpFailureHandler) {
        
        //        guard fansParam.fansType != CMDBFansType.UnKnown else {
        //
        //            printLog(CMDBCommonExceptionCodeType.FansTypeUnSelected.rawValue)
        //
        //            throw CMDBCommonExceptionType.ExceptionCode(code: CMDBCommonExceptionCodeType.FansTypeUnSelected)
        //        }
        
        CMDBHttpManager.getInstance.request(fansParam.URLString(), param: fansParam.keyValues, success: { (sysTime, data, page) in
            
            handler(isSuccess: true)
            
            }, error: error, failure: failure)
        
    }
}